package io.renren.modules.generator.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.generator.entity.SysMenuTestEntity;
import io.renren.modules.generator.service.SysMenuTestService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 菜单管理
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-03-29 19:54:29
 */
@RestController
@RequestMapping("generator/sysmenutest")
public class SysMenuTestController {
    @Autowired
    private SysMenuTestService sysMenuTestService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:sysmenutest:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysMenuTestService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{menuId}")
    @RequiresPermissions("generator:sysmenutest:info")
    public R info(@PathVariable("menuId") Long menuId){
		SysMenuTestEntity sysMenuTest = sysMenuTestService.getById(menuId);

        return R.ok().put("sysMenuTest", sysMenuTest);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:sysmenutest:save")
    public R save(@RequestBody SysMenuTestEntity sysMenuTest){
		sysMenuTestService.save(sysMenuTest);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:sysmenutest:update")
    public R update(@RequestBody SysMenuTestEntity sysMenuTest){
		sysMenuTestService.updateById(sysMenuTest);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:sysmenutest:delete")
    public R delete(@RequestBody Long[] menuIds){
		sysMenuTestService.removeByIds(Arrays.asList(menuIds));

        return R.ok();
    }

}
